<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:HelixToolkit">

    <Style TargetType="{x:Type local:StereoControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:StereoControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:Viewport3DController}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Viewport3DController}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <AdornerDecorator>
                                <ContentPresenter/>
                            </AdornerDecorator>

                            <local:CameraController x:Name="PART_CameraControl" 
                                CameraRotationMode="{TemplateBinding CameraRotationMode}"
                                CameraMode="{TemplateBinding CameraMode}"
                                InfiniteSpin="{TemplateBinding InfiniteSpin}"
                                                    />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:HelixView3D}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:HelixView3D}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <local:CameraController x:Name="PART_CameraController" 
                                                 ShowCameraTarget="{TemplateBinding ShowCameraTarget}"
                                                 CameraRotationMode="{TemplateBinding CameraRotationMode}"
                                                 CameraMode="{TemplateBinding CameraMode}"
                                                 InfiniteSpin="{TemplateBinding InfiniteSpin}"
                                                 InertiaFactor="{TemplateBinding CameraInertiaFactor}"
                                                 RotationSensitivity="{TemplateBinding RotationSensitivity}"
                                                 ModelUpDirection="{TemplateBinding ModelUpDirection}"
                                                 />

                            <AdornerDecorator x:Name="PART_AdornerLayer" DataContext="{TemplateBinding DataContext}">
                                <!-- the main viewport3D is inserted here -->
                            </AdornerDecorator>

                            <!-- Coordinate system -->
                            <Viewport3D x:Name="PART_CoordinateView" Width="80" Height="80" Margin="0"  
                                HorizontalAlignment="Left" VerticalAlignment="Bottom" ClipToBounds="False"
                                Visibility="{TemplateBinding ShowCoordinateSystem, Converter={local:BoolToVisibilityConverter}}">
                                <local:ArrowVisual3D Point2="10 0 0" Fill="Red"/>
                                <local:ArrowVisual3D Point2="0 10 0" Fill="Green"/>
                                <local:ArrowVisual3D Point2="0 0 10" Fill="Blue"/>
                                <!--
                                <local:PieSliceVisual3D Normal="1,0,0" UpVector="0,0,1" InnerRadius="3" OuterRadius="6"  Fill="#80ff0000"/>
                                <local:PieSliceVisual3D Normal="0,1,0" UpVector="1,0,0" InnerRadius="3" OuterRadius="6"  Fill="#8000ff00"/>
                                <local:PieSliceVisual3D Normal="0,0,1" UpVector="0,1,0" InnerRadius="3" OuterRadius="6"  Fill="#800000ff"/>
-->
                            </Viewport3D>


                            <Border VerticalAlignment="Top" Background="{TemplateBinding TitleBackground}">
                                <Grid>
                                    <!-- Titles -->
                                    <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5">
                                        <!-- Title -->
                                        <TextBlock Text="{TemplateBinding Title}" 
                                                   FontWeight="Bold" 
                                                   FontFamily="{TemplateBinding TitleFontFamily}" 
                                                   FontSize="{TemplateBinding TitleSize}" 
                                                   Foreground="{TemplateBinding TextBrush}"/>
                                        <!-- SubTitle -->
                                        <TextBlock Text="{TemplateBinding SubTitle}" 
                                                   FontSize="{TemplateBinding SubTitleSize}" 
                                                   FontFamily="{TemplateBinding TitleFontFamily}" 
                                                   Foreground="{TemplateBinding TextBrush}"/>
                                    </StackPanel>

                                    <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10">
                                        <!-- Framerate -->
                                        <TextBlock 
                                                 HorizontalAlignment="Right"
                                                 Text="{TemplateBinding FrameRateText}"                                             
                                                 Foreground="{TemplateBinding TextBrush}"
                                                 Visibility="{TemplateBinding ShowFrameRate, Converter={local:BoolToVisibilityConverter}}" />

                                        <TextBlock 
                                                 HorizontalAlignment="Right"
                                                 Text="{TemplateBinding FieldOfViewText}"                                             
                                                 Foreground="{TemplateBinding TextBrush}"
                                                 Visibility="{TemplateBinding ShowFieldOfView, Converter={local:BoolToVisibilityConverter}}" />

                                        <!--<TextBlock Text="{TemplateBinding DebugInfo}"/>-->

                                        <!-- Status -->
                                        <TextBlock  HorizontalAlignment="Right" Text="{TemplateBinding Status}"  Foreground="{TemplateBinding TextBrush}"/>

                                    </StackPanel>
                                </Grid>
                            </Border>

                            <Viewport3D x:Name="PART_ViewCubeView" Width="80" Height="80" Margin="0" Opacity="0.5"
                                HorizontalAlignment="Right" VerticalAlignment="Bottom" ClipToBounds="False"
                                Visibility="{TemplateBinding ShowViewCube, Converter={local:BoolToVisibilityConverter}}">
                                <local:ViewCubeVisual3D x:Name="PART_ViewCube" ModelUpDirection="{Binding ModelUpDirection, RelativeSource={RelativeSource TemplatedParent}}"/>                                
                            </Viewport3D>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
